//
//  TagNumberCell.m
//  timelyRain
//
//  Created by Jiafei Wei on 16/10/10.
//  Copyright © 2016年 Jiafei Wei. All rights reserved.
//

#import "TagNumberCell.h"
@interface TagNumberCell()
@property (weak, nonatomic) IBOutlet UILabel *phone;
@property (weak, nonatomic) IBOutlet UILabel *time;

@property (weak, nonatomic) IBOutlet UILabel *type;
@property (weak, nonatomic) IBOutlet UILabel *typeNumber;
@property (weak, nonatomic) IBOutlet UILabel *local;

@property (weak, nonatomic) IBOutlet UIButton *delete;
- (IBAction)deleteBalck:(id)sender;

@end
@implementation TagNumberCell

- (void)awakeFromNib {
    [super awakeFromNib];
    _delete.layer.masksToBounds = YES;
    _delete.layer.cornerRadius = 13.5;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
}

- (IBAction)deleteBalck:(id)sender {
    if(_delegate && _indexPath && [_delegate respondsToSelector:@selector(deletItem:)])
    {
        [_delegate deletItem:self.indexPath];
    }
}
//创建自定义可重用的cell对象
+(instancetype)setTagNumberCellWithTableView:(UITableView *)tableView
{
    static NSString *reuseId = @"ContactCell";
    TagNumberCell *cell = [tableView dequeueReusableCellWithIdentifier:reuseId];
    if (cell == nil) {
        cell = [[[NSBundle mainBundle] loadNibNamed:@"TagNumberCell" owner:nil options:nil] lastObject];
    }
    return cell;
}
-(void)setInfo:(TagInfo *)info{
    _info =info;
    _phone.text=_info.phone;
    _typeNumber.text=_info.tagTypeNumber;
    _local.text=_info.local;
    _time.text =_info.time;
    _type.text=_info.tagType;
}
-(void)setBlackInfo:(TagInfo *)blackInfo{
    _blackInfo =blackInfo;
    _delete.hidden=NO;
    _local.hidden=YES;
    _time.hidden =YES;
    _type.hidden=YES;
    _phone.text=_blackInfo.phone;
    _typeNumber.text=_blackInfo.tagTypeNumber;
}
@end
